import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default ({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  return defineConfig({
    plugins: [vue()],
    resolve: {
      alias: [
        {
          find: '@',
          replacement: resolve(__dirname, 'src')//@形式查找
        }
      ]
    },
    server: {
      host: '0.0.0.0',
      https: false,
      proxy: {
        "/apis": {
          target: "https://smms.app",
          changeOrigin: true,
          secure: false,
          headers: {
            Referer: "https://smms.app",
          },
          rewrite: (path) => path.replace(/^\/apis/,'')
        }
      }
    }
  })
}
